< previous page page_97 next page >

Page 97
Puzzle 22
What Is That Mapped Drive? Part 2
Now that you know how to obtain the server information for a mapped local drive, how do you obtain other information, such as the name of the network provider?
The WNetGetResourceInformation function can be used to obtain information about a network resource by loading a NETRESOURCE structure for the resource. This structure is defined in the API documentation as follows:
typedef struct _NETRESOURCE { // nr
DWORD dwScope;
DWORD dwType;
DWORD dwDisplayType;
DWORD dwUsage;
LPTSTR lpLocalName;
LPTSTR lpRemoteName;
LPTSTR lpComment;
LPTSTR lpProvider;
} NETRESOURCE;
The WNetGetResourceInformation function is defined as follows:
DWORD WNetGetResourceInformation (
   LPNETRESOURCE lpNetResource,  // Specifies the network resource
                                 // for which information is required
   LPVOID lpBuffer,              // Specifies a buffer to contain
                                 // the information
   LPDWORD lpcbBuffer,           // Specifies the size of the buffer
                                 // pointed to by lpBuffer
   LPTSTR *lplpSystem            // Pointer to a string in the
                                 // output buffer
   );
The lpNetResource parameter is a pointer to a NETRESOURCE structure that defines the network resource for which to obtain information. The

 
< previous page page_97 next page >